<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #show{
            width:500px;
            height:50px;
            border: 2px solid blue;
        }
        [ng-cloak]{
            display: none;
        }
    </style>
</head>
<body ng-app="app" ng-controller="ctrl">


<div id="show" ng-cloak>
    {{x+cs+y}}
        =
    {{result}}
</div>
<form action="">
    <input type="button" value="1" ng-click="xy(1)">
    <input type="button" value="2" ng-click="xy(2)">
    <input type="button" value="3" ng-click="xy(3)">
    <input type="button" value="4" ng-click="xy(4)">
    <input type="button" value="5" ng-click="xy(5)">
    <input type="button" value="6" ng-click="xy(6)">
    <input type="button" value="7" ng-click="xy(7)">
    <input type="button" value="8" ng-click="xy(8)">
    <input type="button" value="9" ng-click="xy(9)">
    <input type="button" value="0" ng-click="xy(0)">

    <br><br>
    <input type="button" value="+" ng-click="charset('+')">
    <input type="button" value="-" ng-click="charset('-')">
    <input type="button" value="*" ng-click="charset('*')">
    <input type="button" value="/" ng-click="charset('/')">
    <br><br>

    <br><br><br>
    <!--隐藏域-->
<!--    <input type="hidden" ng-model="x" ng-value="x">-->
<!--    <input type="hidden" ng-model="cs" ng-value="cs">-->
<!--    <input type="hidden" ng-model="y" ng-value="y">-->

</form>

<script src="angular.min.js"></script>

<script>


    var app = angular.module('app',[]);
    app.controller('ctrl',['$scope',function($scope){

        $scope.x = '';
        $scope.y = '';
//        状态变量
        $scope.sta = 1;
//        结果

//        数字按钮的事件
        $scope.xy = function (num) {
            if ($scope.sta==1) {
                $scope.x = $scope.x+num;
            }
            if ($scope.sta==2) {
                $scope.y = $scope.y+num;
                switch($scope.cs){
                    case '+':
                        $scope.result = $scope.x*1+$scope.y*1;
                        break;
                    case '-':
                        $scope.result = $scope.x*1-$scope.y*1;
                        break;
                    case '*':
                        $scope.result = $scope.x*1*$scope.y*1;
                        break;
                    case '/':
                        $scope.result = $scope.x*1/$scope.y*1;
                        break;
                }
            }

        }

//        符号事件
        $scope.charset = function (cs) {
            $scope.cs = cs;
            $scope.sta=2;
        }

    }])



</script>
</body>
</html>